﻿@using PAMD
@using PAMD.Business.Models
@model PAMD.Business.Models.ProfileModel
@{
    ViewBag.Title = SiteConstant.Slogan;
    Layout = "../Shared/_Layout.cshtml";
}
<script type="text/javascript" language="javascript">

    $(document).ready(function (event) {


        $('#UserDetail_DateOfBirth').datepicker({ dateFormat: 'dd-mm-yy', changeYear: true, defaultDate: '06-01-1978' });

        @if(Model.UserDetail.DateOfBirth.HasValue)
          {
                @:$('#UserDetail_DateOfBirth').val('@Model.UserDetail.DateOfBirth.Value.ToString("dd-MM-yyyy")');
           }

        $('#SaveButton').click(function () {

            $('#termsError').hide();

            var validated = ValidateForm();
            return validated;
        });

    });

</script>
@using (Html.BeginForm("Save", "Profile"))
{
    <div class="form-container">
        <strong>@string.Format("{0}'s profile", Model.UserDetail.FirstName)</strong>
        <fieldset class="field-container">
            <div>
                @if (ViewBag.Error != null && ViewBag.Error != "")
                {
                    <div class="red-box">
                        @ViewBag.Error
                    </div>
                }
                
                <div class="left-align">
                    <div style="width: 45%" class="boxed left-align">
                        <div class="highlight-blue">
                            Your Details</div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="UserDetail_Email">
                                    E-Mail &nbsp;</label>
                                @Html.TextBoxFor(m => m.UserDetail.Email, new { disabled = "disabled", @class = "ui-state-disabled inputBoxSmall blueLink" })
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="UserDetail_FirstName">
                                    First name &nbsp;</label>
                                @Html.TextBoxFor(m => m.UserDetail.FirstName, new { disabled = "disabled", @class = "ui-state-disabled inputBoxSmall blueLink" })
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="UserDetail_LastName">
                                    Last name &nbsp;</label>
                                @Html.TextBoxFor(m => m.UserDetail.LastName, new { disabled = "disabled", @class = "ui-state-disabled inputBoxSmall blueLink" })
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="UserDetail_ContactNumber">
                                    Telephone&nbsp;</label>
                                @Html.TextBoxFor(m => m.UserDetail.ContactNumber, new { validation = "required", @class = "inputBoxSmall" })</div>
                            <div id="UserDetail_ContactNumber_Error" class="error-box">
                                Please enter contact number.
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="UserDetail_Mobile">
                                    Mobile&nbsp;</label>
                                @Html.TextBoxFor(m => m.UserDetail.Mobile, new { validation = "required", @class = "inputBoxSmall" })</div>
                            <div id="UserDetail_Mobile_Error" class="error-box">
                                Please enter mobile number.
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="UserDetail_DateOfBirth">
                                    Your date of birth &nbsp;</label>
                                @Html.TextBoxFor(m => m.UserDetail.DateOfBirth, new { validation = "required", @class = "inputBoxSmall" })
                            </div>
                            <div id="UserDetail_DateOfBirth_Error" class="error-box">
                                Please select birth date.
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="UserDetail_Occupation">
                                    Your occupation &nbsp;</label>
                                @Html.DropDownListFor(m => m.UserDetail.Occupation, Model.OccupationList, new { validation = "required", @class = "inputBoxSmall" })
                            </div>
                            <div id="UserDetail_Occupation_Error" class="error-box">
                                Please select country.
                            </div>
                        </div>
                    </div>
                    <div style="width: 45%" class="boxed right-align">
                        <div class="highlight-blue">
                            Your Address</div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="Address_Line1">
                                    Address line 1 &nbsp;</label>
                                @Html.TextBoxFor(m => m.Address.Line1, new { validation = "required", @class = "inputBoxSmall" })
                            </div>
                            <div id="Address_Line1_Error" class="error-box">
                                Please enter address line.
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="Address_Line2">
                                    Address line 2 &nbsp;</label>
                                @Html.TextBoxFor(m => m.Address.Line2, new { @class = "inputBoxSmall" })
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="Address_City">
                                    City &nbsp;</label>
                                @Html.TextBoxFor(m => m.Address.City, new { validation = "required", @class = "inputBoxSmall" })
                            </div>
                            <div id="Address_City_Error" class="error-box">
                                Please enter your city.
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="Address_County">
                                    County &nbsp;</label>
                                @Html.TextBoxFor(m => m.Address.County, new { validation = "required", @class = "inputBoxSmall" })
                            </div>
                            <div id="Address_County_Error" class="error-box">
                                Please enter your county.
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="Address_PostCode">
                                    Postcode &nbsp;</label>
                                @Html.TextBoxFor(m => m.Address.PostCode, new { validation = "required", @class = "inputBoxSmall" })
                            </div>
                            <div id="Address_PostCode_Error" class="error-box">
                                Please enter your postcode.
                            </div>
                        </div>
                        <div class="left-align">
                            <div class="controlBoxSmall">
                                <label for="Address_Country">
                                    Country &nbsp;</label>
                                @Html.DropDownListFor(m => m.Address.Country, Model.Countries, new { validation = "required", @class = "inputBoxSmall" })
                            </div>
                            <div id="Address_Country_Error" class="error-box">
                                Please select country.
                            </div>
                        </div>
                    </div>                   
                </div>
                 <div class="left-align">
                   <label for="">
                    &nbsp;
                </label>
                        <input type="submit" id="SaveButton" style="margin-left: 400px;"  value="Save Details" />
                    </div>
            </div>
        </fieldset>
    </div>
}